﻿<UserControl x:Class="SharpMap.Wpf.MapToolBar"
             x:Name="_this"
    xmlns:local="clr-namespace:SharpMap.Wpf"
    xmlns:smp="clr-namespace:SharpMap.Presentation.Wpf;assembly=SharpMap.Presentation.Wpf"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   >
    <UserControl.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="ToolDataTemplate">
                <ToggleButton Style="{DynamicResource {x:Static ToolBar.ToggleButtonStyleKey}}"
                              Content="{Binding Name}"
                              Command="{x:Static smp:MapViewCommands.SetActiveTool}"
                              CommandTarget="{Binding TargetView, ElementName=_this}"
                              CommandParameter="{Binding}"
                              IsChecked="{Binding IsActive}"
                        >
                </ToggleButton>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <ToolBarTray>
            <ToolBar>
            <Button DataContext="{x:Static smp:MapViewCommands.ZoomToExtents}"
                    Command="{Binding}"
                    CommandTarget="{Binding TargetView, ElementName=_this}"
                    Content="{Binding Text}"
                    />
        </ToolBar>
            <ToolBar ItemsSource="{Binding ViewTools}" ItemTemplate="{StaticResource ToolDataTemplate}">

            </ToolBar>
        </ToolBarTray>
</UserControl>
